<?php

namespace App\Http\Controllers\Setting;

use App\Models\Journal;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class VersionController extends Controller
{
    /** 更新记录 */
    public function index(Request $request)
    {
        $model = Journal::orderBy('created_at','desc')->get();
        return view('setting.version.index',['model'=>$model]);
    }

    /** 添加更新记录 */
    public function edit(Request $request)
    {
        if($request->isMethod('post')){
            $data = $request->all();
            $model = new Journal();
            $model->title   = $data['title'];
            $model->content = $data['content'];
            $model->save();

            return $this->success('添加成功!');
        }
        return view('setting.version.edit');
    }
}
